<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <title>集成bgfx开源的渲染器 | 小魏的博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
    <meta name="keywords" content="Vker,Vker's Blog">
  
  <meta name="description" content="这一节主要讲解集成一个bgfx到项目中bgfx github 仓库地址  涉及的知识点,如下:   使用 xmake 构建工程, xmake 使用lua 不会可以简单的补一下语法 修复编译 bgfx 时报的错误 编译 shaderc 可执行文件 编译 glsl 到二进制, 因为bgfx 使用编译后的着色器代码">
<meta name="keywords" content="前端,cpp,bgfx,xmake,lua">
<meta property="og:type" content="article">
<meta property="og:title" content="集成bgfx开源的渲染器">
<meta property="og:url" content="https://leng521.top/posts/ea56194d/index.html">
<meta property="og:site_name" content="小魏的博客">
<meta property="og:description" content="这一节主要讲解集成一个bgfx到项目中bgfx github 仓库地址  涉及的知识点,如下:   使用 xmake 构建工程, xmake 使用lua 不会可以简单的补一下语法 修复编译 bgfx 时报的错误 编译 shaderc 可执行文件 编译 glsl 到二进制, 因为bgfx 使用编译后的着色器代码">
<meta property="og:locale" content="default">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/1.gif">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/1.png">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/2.png">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/3.png">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/5.png">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/4.png">
<meta property="og:image" content="https://leng521.top/posts/ea56194d/6.png">
<meta property="og:updated_time" content="2019-09-14T12:59:20.138Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="集成bgfx开源的渲染器">
<meta name="twitter:description" content="这一节主要讲解集成一个bgfx到项目中bgfx github 仓库地址  涉及的知识点,如下:   使用 xmake 构建工程, xmake 使用lua 不会可以简单的补一下语法 修复编译 bgfx 时报的错误 编译 shaderc 可执行文件 编译 glsl 到二进制, 因为bgfx 使用编译后的着色器代码">
<meta name="twitter:image" content="https://leng521.top/posts/ea56194d/1.gif">
  
  
    <link rel="icon" href="/head.jpg">
  
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css">
  <script src="/js/pace.min.js"></script>
  

  
	<script>
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?2eaff0c5326867354b0d3469d507d209";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
	</script>

  

</head>
</html>
<body>
  <div id="container">
      <header id="header">
    <div id="banner"></div>
    <div id="header-outer">
        <div id="header-menu" class="header-menu-pos animated">
            <div class="header-menu-container">
                <a href="/" class="left">
                    <span class="site-title">Vker&#39;s Blog</span>
                </a>
                <nav id="header-menu-nav" class="right">
                    
                    <a  href="/">
                        <i class="fa fa-home"></i>
                        <span>Home</span>
                    </a>
                    
                    <a  href="/archives">
                        <i class="fa fa-archive"></i>
                        <span>Archives</span>
                    </a>
                    
                    <a  href="/about">
                        <i class="fa fa-user"></i>
                        <span>About</span>
                    </a>
                    
                </nav>
                <a class="mobile-header-menu-button">
                    <i class="fa fa-bars"></i>
                </a>
            </div>
        </div>
        <div id="header-row">
            <div id="logo">
                <a href="/">
                    <img src="/head.jpg" alt="logo">
                </a>
            </div>
            <div class="header-info">
                <div id="header-title">
                    
                    <h2>
                        Vker&#39;s Blog
                    </h2>
                    
                </div>
                <div id="header-description">
                    
                    <h3>
                        一个专注 游戏研发 的技术博客
                    </h3>
                    
                </div>
            </div>
            <nav class="header-nav">
                <div class="social">
                    
                        <a title="Vker" target="_blank" href="//leng521.top">
                            <i class="fa fa-home fa-2x"></i></a>
                    
                        <a title="Github" target="_blank" href="//github.com">
                            <i class="fa fa-github fa-2x"></i></a>
                    
                        <a title="Weibo" target="_blank" href="//weibo.com">
                            <i class="fa fa-weibo fa-2x"></i></a>
                    
                        <a title="Twitter" target="_blank" href="//twitter.com">
                            <i class="fa fa-twitter fa-2x"></i></a>
                    
                </div>
            </nav>
        </div>
    </div>
</header>
      <div class="outer">
        <section id="main" class="body-wrap"><article id="post-集成bgfx开源的渲染器" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="post-title" itemprop="name">
      集成bgfx开源的渲染器
    </h1>
    <div class="post-title-bar">
      <ul>
          
              <li>
                  <i class="fa fa-book"></i>
                  
                      <a href="/categories/前端/">前端</a>
                  
                      <a href="/categories/bgfx/">bgfx</a>
                  
              </li>
          
        <li>
          <i class="fa fa-calendar"></i>  2019-07-31
        </li>
        <li>
          <i class="fa fa-eye"></i>
          <span id="busuanzi_value_page_pv"></span>
        </li>
      </ul>
    </div>
  

          
      </header>
    
    <div class="article-entry post-content" itemprop="articleBody">
      
            
            <p>这一节主要讲解集成一个bgfx到项目中<br><a href="https://github.com/bkaradzic/bgfx">bgfx github 仓库地址</a></p>
<blockquote>
<p>涉及的知识点,如下:</p>
</blockquote>
<ol>
<li>使用 xmake 构建工程, xmake 使用lua 不会可以简单的补一下语法</li>
<li>修复编译 bgfx 时报的错误</li>
<li>编译 shaderc 可执行文件</li>
<li>编译 glsl 到二进制, 因为bgfx 使用编译后的着色器代码</li>
</ol>
<a id="more"></a>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">当前测试的版本</span><br><span class="line">bgfx: commit id =&gt; c14ea22eee5866a580899027ef42b3867faa280c</span><br><span class="line"></span><br><span class="line">bx: commit id =&gt; 7036e3d2d7f73513fc6bed25c969f2cb2818a884</span><br><span class="line"></span><br><span class="line">bimg: commit id =&gt; dab021bc46dabba270123a32cc1c2f8102593e13</span><br><span class="line"></span><br><span class="line">xmake: v2.2.5.201904012115</span><br><span class="line"></span><br><span class="line">vs: VS2019</span><br><span class="line"></span><br><span class="line">使用 cl 编译器</span><br><span class="line"></span><br><span class="line">vscode: 1.36.1</span><br><span class="line"></span><br><span class="line">系统: win10</span><br><span class="line"></span><br><span class="line">时间: 2019年7月31日17:23:13</span><br></pre></td></tr></table></figure>
<h3 id="达到的效果"><a href="#达到的效果" class="headerlink" title="达到的效果"></a>达到的效果</h3><p>集成 glm, glfw, bgfx, bx, bimg 库到项目中, 并成功跑起来bgfx中第二个案例<br><!-- https://v.youku.com/v_show/id_XNDI5NTEzNjAyNA==.html?spm=a2h3j.8428770.3416059.1 --><br><img src="/posts/ea56194d/1.gif"><br><!-- [视频展示](https://video.tudou.com/v/XNDI5NTEzNjAyNA==.html?spm=a2hzp.8244740.0.0) --></p>
<h3 id="可能会用到的链接地址"><a href="#可能会用到的链接地址" class="headerlink" title="可能会用到的链接地址"></a>可能会用到的链接地址</h3><h4 id="源码地址"><a href="#源码地址" class="headerlink" title="源码地址"></a>源码地址</h4><table>
<thead>
<tr>
<th>库的作用</th>
<th>地址</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>开源渲染库</td>
<td><a href="https://github.com/bkaradzic/bgfx">https://github.com/bkaradzic/bgfx</a></td>
<td>-</td>
</tr>
<tr>
<td>跨平台基础库</td>
<td><a href="https://github.com/bkaradzic/bx">https://github.com/bkaradzic/bx</a></td>
<td>-</td>
</tr>
<tr>
<td>Image 库</td>
<td><a href="https://github.com/bkaradzic/bimg">https://github.com/bkaradzic/bimg</a></td>
<td>-</td>
</tr>
<tr>
<td>glm仓库地址</td>
<td><a href="https://github.com/g-truc/glm">https://github.com/g-truc/glm</a></td>
<td>-</td>
</tr>
<tr>
<td>glfw仓库地址</td>
<td><a href="https://github.com/glfw/glfw">https://github.com/glfw/glfw</a></td>
<td>-</td>
</tr>
<tr>
<td>bigg一个使用cmake集成bgfx, imgui, glfw, and glm.</td>
<td><a href="https://github.com/JoshuaBrookover/bigg">https://github.com/JoshuaBrookover/bigg</a></td>
<td>后面一个简单的框架参考与这个库</td>
</tr>
<tr>
<td>bgfx-minimal-example 简单的 helloworld 使用 bgfx</td>
<td><a href="https://github.com/jpcy/bgfx-minimal-example">https://github.com/jpcy/bgfx-minimal-example</a></td>
<td>xmake的构建配置参考与它</td>
</tr>
</tbody>
</table>
<h4 id="参考博客地址"><a href="#参考博客地址" class="headerlink" title="参考博客地址"></a>参考博客地址</h4><table>
<thead>
<tr>
<th>地址</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.cnblogs.com/kileyi/p/8250919.html">https://www.cnblogs.com/kileyi/p/8250919.html</a></td>
<td>shader 的编译参考与这个博客</td>
</tr>
<tr>
<td><a href="https://bkaradzic.github.io/bgfx/build.html">https://bkaradzic.github.io/bgfx/build.html</a></td>
<td>bgfx 官方文档</td>
</tr>
</tbody>
</table>
<h3 id="编译这几个库"><a href="#编译这几个库" class="headerlink" title="编译这几个库"></a>编译这几个库</h3><p><em>注意这里xmake.lua配置现在只能运行在windows</em></p>
<blockquote>
<p>需要如下几个库<br><img src="/posts/ea56194d/1.png"></p>
</blockquote>
<blockquote>
<p>工程的分布图<br><img src="/posts/ea56194d/2.png"></p>
</blockquote>
<h4 id="最上面的基础配置"><a href="#最上面的基础配置" class="headerlink" title="最上面的基础配置"></a>最上面的基础配置</h4><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">local</span> BGFX_DIR = <span class="string">"deps/bgfx/"</span></span><br><span class="line"><span class="keyword">local</span> BX_DIR = <span class="string">"deps/bx/"</span></span><br><span class="line"><span class="keyword">local</span> BIMG_DIR = <span class="string">"deps/bimg/"</span></span><br><span class="line"><span class="keyword">local</span> GLFW_DIR = <span class="string">"deps/glfw-3.3/"</span></span><br><span class="line"><span class="keyword">local</span> GLM_DIR = <span class="string">"deps/glm"</span></span><br><span class="line"></span><br><span class="line">set_project(<span class="string">"vker"</span>)</span><br><span class="line">set_version(<span class="string">"0.0.1"</span>)</span><br><span class="line"></span><br><span class="line">add_rules(<span class="string">"mode.debug"</span>, <span class="string">"mode.release"</span>)</span><br></pre></td></tr></table></figure>
<h4 id="编译-bgfx-的xmake配置"><a href="#编译-bgfx-的xmake配置" class="headerlink" title="编译 bgfx 的xmake配置"></a>编译 bgfx 的xmake配置</h4><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">target(<span class="string">"bgfx"</span>)</span><br><span class="line">    set_kind(<span class="string">"static"</span>)</span><br><span class="line">    </span><br><span class="line">    set_targetdir(<span class="string">"$(buildir)/libs"</span>)</span><br><span class="line"></span><br><span class="line">    add_defines(<span class="string">"__STDC_LIMIT_MACROS"</span></span><br><span class="line">                , <span class="string">"__STDC_FORMAT_MACROS"</span></span><br><span class="line">                , <span class="string">"__STDC_CONSTANT_MACROS"</span></span><br><span class="line">                , <span class="string">"NDEBUG"</span></span><br><span class="line">                , <span class="string">"WIN32"</span></span><br><span class="line">                , <span class="string">"_WIN32"</span></span><br><span class="line">                , <span class="string">"_HAS_EXCEPTIONS=0"</span></span><br><span class="line">                , <span class="string">"_HAS_ITERATOR_DEBUGGING=0"</span></span><br><span class="line">                , <span class="string">"_ITERATOR_DEBUG_LEVEL=0"</span></span><br><span class="line">                , <span class="string">"_SCL_SECURE=0"</span></span><br><span class="line">                , <span class="string">"_SECURE_SCL=0"</span></span><br><span class="line">                , <span class="string">"_SCL_SECURE_NO_WARNINGS"</span></span><br><span class="line">                , <span class="string">"_CRT_SECURE_NO_WARNINGS"</span></span><br><span class="line">                , <span class="string">"_CRT_SECURE_NO_DEPRECATE"</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> is_mode(<span class="string">"debug"</span>) <span class="keyword">then</span></span><br><span class="line">        add_defines(<span class="string">"BGFX_CONFIG_DEBUG=1"</span>)</span><br><span class="line">    <span class="keyword">end</span></span><br><span class="line"></span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"3rdparty"</span>)</span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"3rdparty/dxsdk/include"</span>)</span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"3rdparty/khronos"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include/compat/msvc"</span>)</span><br><span class="line">    add_includedirs(BIMG_DIR .. <span class="string">"include"</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment">-- default cl complier</span></span><br><span class="line">    add_files(BGFX_DIR .. <span class="string">"src/**.cpp|amalgamated.cpp"</span>) <span class="comment">--|glcontext_glx.cpp|glcontext_egl.cpp</span></span><br><span class="line">    add_syslinks(<span class="string">"user32"</span>, <span class="string">"gdi32"</span>)</span><br></pre></td></tr></table></figure>
<ul>
<li>设置构建静态库</li>
<li>设置构建静态库的路径</li>
<li>添加预定义宏</li>
<li>添加头文件的搜索路径</li>
<li>添加源文件 并 过滤掉 <code>amalgamated.cpp|glcontext_glx.cpp|glcontext_egl.cpp</code> 这三个cpp文件 不会出现函数重定义问题</li>
<li>依赖系统库 <code>user32, gdi32</code></li>
</ul>
<h4 id="编译-bx-的xmake配置"><a href="#编译-bx-的xmake配置" class="headerlink" title="编译 bx 的xmake配置"></a>编译 bx 的xmake配置</h4><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">set_kind(<span class="string">"static"</span>)</span><br><span class="line"></span><br><span class="line">    set_targetdir(<span class="string">"$(buildir)/libs"</span>)</span><br><span class="line">    add_defines(<span class="string">"__STDC_LIMIT_MACROS"</span></span><br><span class="line">                , <span class="string">"__STDC_FORMAT_MACROS"</span></span><br><span class="line">                , <span class="string">"__STDC_CONSTANT_MACROS"</span></span><br><span class="line">                , <span class="string">"NDEBUG"</span></span><br><span class="line">                , <span class="string">"WIN32"</span></span><br><span class="line">                , <span class="string">"_WIN32"</span></span><br><span class="line">                , <span class="string">"_HAS_EXCEPTIONS=0"</span></span><br><span class="line">                , <span class="string">"_HAS_ITERATOR_DEBUGGING=0"</span></span><br><span class="line">                , <span class="string">"_ITERATOR_DEBUG_LEVEL=0"</span></span><br><span class="line">                , <span class="string">"_SCL_SECURE=0"</span></span><br><span class="line">                , <span class="string">"_SECURE_SCL=0"</span></span><br><span class="line">                , <span class="string">"_SCL_SECURE_NO_WARNINGS"</span></span><br><span class="line">                , <span class="string">"_CRT_SECURE_NO_WARNINGS"</span></span><br><span class="line">                , <span class="string">"_CRT_SECURE_NO_DEPRECATE"</span>)</span><br><span class="line"></span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include/bx/inline"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include/compat/msvc"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"3rdparty"</span>)</span><br><span class="line"></span><br><span class="line">    add_files(BX_DIR .. <span class="string">"src/**.cpp|amalgamated.cpp"</span>) <span class="comment">--|crtnone.cpp</span></span><br></pre></td></tr></table></figure>
<ul>
<li>设置构建静态库</li>
<li>设置构建静态库的路径</li>
<li>添加预定义宏</li>
<li>添加头文件的搜索路径</li>
<li>添加源文件 并 过滤掉 <code>amalgamated.cpp|crtnone.cpp</code> 这两个cpp文件 不会出现函数重定义问题</li>
</ul>
<h4 id="编译-bimg-的xmake配置"><a href="#编译-bimg-的xmake配置" class="headerlink" title="编译 bimg 的xmake配置"></a>编译 bimg 的xmake配置</h4><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">set_kind(<span class="string">"static"</span>)</span><br><span class="line"></span><br><span class="line">    set_targetdir(<span class="string">"$(buildir)/libs"</span>)</span><br><span class="line"></span><br><span class="line">    add_defines(<span class="string">"__STDC_LIMIT_MACROS"</span></span><br><span class="line">                , <span class="string">"__STDC_FORMAT_MACROS"</span></span><br><span class="line">                , <span class="string">"__STDC_CONSTANT_MACROS"</span></span><br><span class="line">                , <span class="string">"NDEBUG"</span></span><br><span class="line">                , <span class="string">"WIN32"</span></span><br><span class="line">                , <span class="string">"_WIN32"</span></span><br><span class="line">                , <span class="string">"_HAS_EXCEPTIONS=0"</span></span><br><span class="line">                , <span class="string">"_HAS_ITERATOR_DEBUGGING=0"</span></span><br><span class="line">                , <span class="string">"_ITERATOR_DEBUG_LEVEL=0"</span></span><br><span class="line">                , <span class="string">"_SCL_SECURE=0"</span></span><br><span class="line">                , <span class="string">"_SECURE_SCL=0"</span></span><br><span class="line">                , <span class="string">"_SCL_SECURE_NO_WARNINGS"</span></span><br><span class="line">                , <span class="string">"_CRT_SECURE_NO_WARNINGS"</span></span><br><span class="line">                , <span class="string">"_CRT_SECURE_NO_DEPRECATE"</span>)</span><br><span class="line"></span><br><span class="line">    add_includedirs(BIMG_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BIMG_DIR .. <span class="string">"3rdparty/astc-codec"</span>)</span><br><span class="line">    add_includedirs(BIMG_DIR .. <span class="string">"3rdparty/astc-codec/include"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include/compat/msvc"</span>)</span><br><span class="line">    </span><br><span class="line">    add_files(BIMG_DIR .. <span class="string">"src/image.cpp"</span>)</span><br><span class="line">    add_files(BIMG_DIR .. <span class="string">"src/image_gnf.cpp"</span>)</span><br><span class="line">    add_files(BIMG_DIR .. <span class="string">"3rdparty/astc-codec/src/decoder/*.cc"</span>)</span><br></pre></td></tr></table></figure>
<ul>
<li>设置构建静态库</li>
<li>设置构建静态库的路径</li>
<li>添加预定义宏</li>
<li>添加头文件的搜索路径</li>
<li>添加源文件 并 过滤掉 <code>amalgamated.cpp|glcontext_glx.cpp|glcontext_egl.cpp</code> 这个三个cpp文件 不会出现函数重定义问题</li>
</ul>
<h4 id="编译-glfw-的xmake配置"><a href="#编译-glfw-的xmake配置" class="headerlink" title="编译 glfw 的xmake配置"></a>编译 glfw 的xmake配置</h4><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">target(<span class="string">"glfw"</span>)</span><br><span class="line">    set_kind(<span class="string">"static"</span>)</span><br><span class="line"></span><br><span class="line">    set_targetdir(<span class="string">"$(buildir)/libs"</span>)</span><br><span class="line">    add_includedirs(GLFW_DIR .. <span class="string">"include"</span>)</span><br><span class="line"></span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/context.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/egl_context.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/init.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/input.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/monitor.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/osmesa_context.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/vulkan.c"</span>)</span><br><span class="line">    add_files(GLFW_DIR .. <span class="string">"src/window.c"</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> is_plat(<span class="string">"windows"</span>) <span class="keyword">then</span></span><br><span class="line">        add_defines(<span class="string">"_GLFW_WIN32"</span>, <span class="string">"_CRT_SECURE_NO_WARNINGS"</span>, <span class="string">"_WIN64"</span>)</span><br><span class="line">        </span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/win32_*.c"</span>)</span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/wgl_context.c"</span>)</span><br><span class="line">    <span class="keyword">elseif</span> is_plat(<span class="string">"linux"</span>) <span class="keyword">then</span></span><br><span class="line">        add_defines(<span class="string">"_GLFW_X11"</span>)</span><br><span class="line"></span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/glx_context.c"</span>)</span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/linux*.c"</span>)</span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/posix*.c"</span>)</span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/x11*.c"</span>)</span><br><span class="line">        add_files(GLFW_DIR .. <span class="string">"src/xkb*.c"</span>)</span><br><span class="line">    <span class="keyword">end</span></span><br><span class="line"></span><br><span class="line">    add_syslinks(<span class="string">"shell32"</span>)</span><br></pre></td></tr></table></figure>
<ul>
<li>设置构建静态库</li>
<li>设置构建静态库的路径</li>
<li>添加预定义宏</li>
<li>添加头文件的搜索路径</li>
<li>根据平台添加相应的源文件</li>
<li>依赖系统库 <code>shell32</code></li>
</ul>
<h4 id="编译工程"><a href="#编译工程" class="headerlink" title="编译工程"></a>编译工程</h4><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">target(<span class="string">"vkEngine"</span>)</span><br><span class="line">    add_deps(<span class="string">"bgfx"</span>)</span><br><span class="line">    add_deps(<span class="string">"bx"</span>)</span><br><span class="line">    add_deps(<span class="string">"bimg"</span>)</span><br><span class="line">    add_deps(<span class="string">"glfw"</span>)</span><br><span class="line"></span><br><span class="line">    set_kind(<span class="string">"binary"</span>)</span><br><span class="line"></span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"3rdparty"</span>)</span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"3rdparty/dxsdk/include"</span>)</span><br><span class="line">    add_includedirs(BGFX_DIR .. <span class="string">"3rdparty/khronos"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(BX_DIR .. <span class="string">"include/compat/msvc"</span>)</span><br><span class="line">    add_includedirs(BIMG_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(GLFW_DIR .. <span class="string">"include"</span>)</span><br><span class="line">    add_includedirs(GLM_DIR)</span><br><span class="line"></span><br><span class="line">    add_includedirs(<span class="string">"src/"</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> is_mode(<span class="string">"debug"</span>) <span class="keyword">then</span> </span><br><span class="line">        add_linkdirs(<span class="string">"$(buildir)/libs/debug"</span>)</span><br><span class="line">        add_links(<span class="string">"glfw"</span>, <span class="string">"bgfx"</span>, <span class="string">"bx"</span>, <span class="string">"bimg"</span>)</span><br><span class="line">    <span class="keyword">elseif</span> is_mode(<span class="string">"release"</span>) <span class="keyword">then</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">end</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">-- 显示控制台方便打印输出</span></span><br><span class="line">    add_ldflags(<span class="string">"/SUBSYSTEM:CONSOLE"</span>)</span><br><span class="line"></span><br><span class="line">    add_files(<span class="string">"src/**.cpp"</span>)</span><br></pre></td></tr></table></figure>
<ul>
<li>依赖前面那四个构建任务</li>
<li>设置成可执行文件</li>
<li>添加头文件搜索路径</li>
<li>链接静态库</li>
<li>设置链接 参数</li>
<li>添加源文件</li>
</ul>
<h3 id="编译-Shaderc-工具"><a href="#编译-Shaderc-工具" class="headerlink" title="编译 Shaderc 工具"></a>编译 Shaderc 工具</h3><p>因为 bgfx 使用的 GLSL 是编译后的文件,他们也提供编译 你着色器代码的工具, 但是需要你自己编译</p>
<p>查看文档,生成官方的工程</p>
<blockquote>
<p>构建VS工程<br>cd bgfx<br>..\bx\tools\bin\windows\genie –with-tools –with-shared-lib –with-examples vs2019</p>
</blockquote>
<blockquote>
<p>使用glfw的例子<br>cd bgfx<br>..\bx\tools\bin\windows\genie –with-tools –with-shared-lib –with-glfw –with-examples vs2019</p>
</blockquote>
<blockquote>
<p>使用sdl的例子<br>cd bgfx<br>..\bx\tools\bin\windows\genie –with-tools –with-shared-lib –with-sdl –with-examples vs2019</p>
</blockquote>
<p>xcode 的构建例子也是样的</p>
<blockquote>
<p>建议使用默认的构建工程 ,,, 也就是 不适用 glfw, 或者 sdl</p>
</blockquote>
<p>然后你会看到</p>
<img src="/posts/ea56194d/3.png">
<p>直接编译这些工程就会生成 5个可执行文件,, shder 编译(shderc) 模型编译(geometryc) 模型编译后查看器(geometryv) 纹理编译(texturec) 纹理编译后查看器(texturev)</p>
<h3 id="编译-shader-到二进制"><a href="#编译-shader-到二进制" class="headerlink" title="编译 shader 到二进制"></a>编译 shader 到二进制</h3><p>看他们的例子 每个shader 都会引用 bgfx_shader.sh 和 shaderlib.sh 两个文件</p>
<p>找到下面 shader.mk 文件<br><img src="/posts/ea56194d/5.png"></p>
<p>看下面的内容, 这些东西可以提示你怎么使用 shaderc 编译器</p>
<img src="/posts/ea56194d/4.png">
<p>这个是他们shader编译器的帮助信息</p>
<img src="/posts/ea56194d/6.png">
<h4 id="windows-opengl-命令"><a href="#windows-opengl-命令" class="headerlink" title="windows opengl 命令"></a>windows opengl 命令</h4><p>可以新建一个批处理执行下面的内容</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">shaderc -f ../examples/cubes/vs_cubes.sc -o ..\examples\cubes\shaders\glsl\vs_cubes.bin --platform windows -i ..\examples\cubes\ -p 120 --type vertex</span><br><span class="line">shaderc -f ../examples/cubes/fs_cubes.sc -o ..\examples\cubes\shaders\glsl\fs_cubes.bin --platform windows -i ..\examples\cubes\ -p 120 --type fragment</span><br><span class="line"></span><br><span class="line">pause</span><br></pre></td></tr></table></figure>
<h4 id="windows-dx11-命令"><a href="#windows-dx11-命令" class="headerlink" title="windows dx11 命令"></a>windows dx11 命令</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">shaderc -f ../examples/cubes/vs_cubes.sc -o ..\examples\cubes\shaders\dx11\vs_cubes.bin --platform windows -i ..\examples\cubes\ -p vs_5_0 --type vertex -O 3</span><br><span class="line">shaderc -f ../examples/cubes/fs_cubes.sc -o ..\examples\cubes\shaders\dx11\fs_cubes.bin --platform windows -i ..\examples\cubes\ -p ps_5_0 --type fragment -O 3</span><br><span class="line"></span><br><span class="line">pause</span><br></pre></td></tr></table></figure>
<p>编译参数部分解释</p>
<blockquote>
<p>–varyingdef 指定 varying.def.sc 至于这东西 只是规定, 后面再说.<br>-f 输入文件<br>-o 输出文件<br>–platform 编译平台<br>-i 要包含文件的路径<br>-p 这个参数是着色器的模式 主要参考 shader.mk 里面的参数做参考<br>–type 编译的类型<br>-O &lt;0,1,2,3&gt; DX9 或者 DX11 优化等级</p>
</blockquote>
<h3 id="编译好的可执行文件"><a href="#编译好的可执行文件" class="headerlink" title="编译好的可执行文件"></a>编译好的可执行文件</h3><p>我这里放上我编译好的 macosx平台 Release 版的工具<br>里面包含 <code>geometryc</code>    <code>geometryv</code> <code>texturec</code> <code>texturev</code> <code>shaderc</code></p>
<p><a href="https://www.lanzous.com/i5kf5bg">下载地址</a></p>
<h3 id="ending"><a href="#ending" class="headerlink" title="ending"></a>ending</h3><p>这里我就不放代码了,,, 需要你们自己动手去做,,, 我可以把构建配置发给你们<br>我也只是用了一点, 后面会继续深入,,, 大家一块学习,,, 讨论交流.<br>这个官方的文档比较的少, 不全面, 需要自己多看看他们的例子和源码.</p>
<p>xmake.lua 配置<br><a href="/posts/ea56194d/xmake.lua" title="xmake.lua">xmake.lua</a></p>

            <div class="post-copyright">
    <div class="content">
        <p>最后更新： 2019年09月14日 20:59</p>
        <p>原始链接： <a class="post-url" href="/posts/ea56194d/" title="集成bgfx开源的渲染器">https://leng521.top/posts/ea56194d/</a></p>
        <footer>
            <a href="https://leng521.top">
                <img src="/head.jpg" alt="小魏">
                小魏
            </a>
        </footer>
    </div>
</div>

      
        
            

        
    </div>
    <footer class="article-footer">
        
        
<div class="post-share">
    <a href="javascript:;" id="share-sub" class="post-share-fab">
        <i class="fa fa-share-alt"></i>
    </a>
    <div class="post-share-list" id="share-list">
        <ul class="share-icons">
          <li>
            <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://leng521.top/posts/ea56194d/&title=《集成bgfx开源的渲染器》 — 小魏的博客&pic=https://s2.ax1x.com/2019/08/01/eUkNJs.jpg" data-title="微博">
              <i class="fa fa-weibo"></i>
            </a>
          </li>
          <li>
            <a class="weixin share-sns" id="wxFab" href="javascript:;" data-title="微信">
              <i class="fa fa-weixin"></i>
            </a>
          </li>
          <li>
            <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://leng521.top/posts/ea56194d/&title=《集成bgfx开源的渲染器》 — 小魏的博客&source=这一节主要讲解集成一个bgfx到项目中bgfx github 仓库地址

涉及的知识点,如下:


使用 xmake 构建工程, xmake 使用lua ..." data-title="QQ">
              <i class="fa fa-qq"></i>
            </a>
          </li>
          <li>
            <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://leng521.top/posts/ea56194d/" data-title="Facebook">
              <i class="fa fa-facebook"></i>
            </a>
          </li>
          <li>
            <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《集成bgfx开源的渲染器》 — 小魏的博客&url=https://leng521.top/posts/ea56194d/&via=https://leng521.top" data-title="Twitter">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
          <li>
            <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://leng521.top/posts/ea56194d/" data-title="Google+">
              <i class="fa fa-google-plus"></i>
            </a>
          </li>
        </ul>
     </div>
</div>
<div class="post-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;" id="wxShare-close">×</a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>

<div class="mask"></div>

        
        <ul class="article-footer-menu">
            
            
  <li class="article-footer-tags">
    <i class="fa fa-tags"></i>
      
    <a href="/tags/前端/" class="color3">前端</a>
      
    <a href="/tags/cpp/" class="color4">cpp</a>
      
    <a href="/tags/bgfx/" class="color5">bgfx</a>
      
    <a href="/tags/xmake/" class="color1">xmake</a>
      
    <a href="/tags/lua/" class="color4">lua</a>
      
  </li>

        </ul>
        
    </footer>
  </div>
</article>


    <aside class="post-toc-pos post-toc-top" id="post-toc">
        <nav class="post-toc-wrap">
            <ol class="post-toc"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#达到的效果"><span class="post-toc-text">达到的效果</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#可能会用到的链接地址"><span class="post-toc-text">可能会用到的链接地址</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#源码地址"><span class="post-toc-text">源码地址</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#参考博客地址"><span class="post-toc-text">参考博客地址</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#编译这几个库"><span class="post-toc-text">编译这几个库</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#最上面的基础配置"><span class="post-toc-text">最上面的基础配置</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#编译-bgfx-的xmake配置"><span class="post-toc-text">编译 bgfx 的xmake配置</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#编译-bx-的xmake配置"><span class="post-toc-text">编译 bx 的xmake配置</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#编译-bimg-的xmake配置"><span class="post-toc-text">编译 bimg 的xmake配置</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#编译-glfw-的xmake配置"><span class="post-toc-text">编译 glfw 的xmake配置</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#编译工程"><span class="post-toc-text">编译工程</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#编译-Shaderc-工具"><span class="post-toc-text">编译 Shaderc 工具</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#编译-shader-到二进制"><span class="post-toc-text">编译 shader 到二进制</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#windows-opengl-命令"><span class="post-toc-text">windows opengl 命令</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#windows-dx11-命令"><span class="post-toc-text">windows dx11 命令</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#编译好的可执行文件"><span class="post-toc-text">编译好的可执行文件</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#ending"><span class="post-toc-text">ending</span></a></li></ol>
        </nav>
    </aside>
    

<nav id="article-nav">
  
    <a href="/posts/4c19fcfe/" id="article-nav-newer" class="article-nav-link-wrap">

      <span class="article-nav-title">
        <i class="fa fa-hand-o-left" aria-hidden="true"></i>
        
          集成bgfx在macosx平台
        
      </span>
    </a>
  
  
    <a href="/posts/af81a0c5/" id="article-nav-older" class="article-nav-link-wrap">
      <span class="article-nav-title">WebGL以无符号字节传递颜色的原理</span>
      <i class="fa fa-hand-o-right" aria-hidden="true"></i>
    </a>
  
</nav>



    
        <!-- 来必力City版安装代码 -->
<div id="lv-container" data-id="city" data-uid="MTAyMC8zNDA0MC8xMDU3OA==">
<script type="text/javascript">
   (function(d, s) {
       var j, e = d.getElementsByTagName(s)[0];

       if (typeof LivereTower === 'function') { return; }

       j = d.createElement(s);
       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
       j.async = true;

       e.parentNode.insertBefore(j, e);
   })(document, 'script');
</script>
<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
</div>
<!-- City版安装代码已完成 -->
    
</section>
        
      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info" class="inner">
      
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


      <p>
        Powered by  <a href="http://hexo.io/" target="_blank">Hexo</a>
        Theme <a href="//github.com/wongminho/hexo-theme-miho" target="_blank">MiHo</a>
      &copy; 2019 小魏<br>
      </p>
    </div>
  </div>
</footer>
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
  var mihoConfig = {
      root: "https://leng521.top",
      animate: true,
      isHome: false,
      share: true,
      reward: 0
  }
</script>
<div class="sidebar">
    <div id="sidebar-search" title="Search">
        <i class="fa fa-search"></i>
    </div>
    <div id="sidebar-category" title="Categories">
        <i class="fa fa-book"></i>
    </div>
    <div id="sidebar-tag" title="Tags">
        <i class="fa fa-tags"></i>
    </div>
    <div id="sidebar-top">
        <span class="sidebar-top-icon"><i class="fa fa-angle-up"></i></span>
    </div>
</div>
<div class="sidebar-menu-box" id="sidebar-menu-box">
    <div class="sidebar-menu-box-container">
        <div id="sidebar-menu-box-categories">
            <a class="category-link" href="/categories/Cocos-Creator/">Cocos Creator</a><a class="category-link" href="/categories/QQ玩一玩/">QQ玩一玩</a><a class="category-link" href="/categories/cocos2d-x/">cocos2d-x</a><a class="category-link" href="/categories/cocos2dx/">cocos2dx</a><a class="category-link" href="/categories/git/">git</a><a class="category-link" href="/categories/hexo/">hexo</a><a class="category-link" href="/categories/js/">js</a><a class="category-link" href="/categories/linux/">linux</a><a class="category-link" href="/categories/python/">python</a><a class="category-link" href="/categories/前端/">前端</a><a class="category-link" href="/categories/前端/WebGL/">WebGL</a><a class="category-link" href="/categories/前端/bgfx/">bgfx</a><a class="category-link" href="/categories/后端/">后端</a><a class="category-link" href="/categories/后端/golang/">golang</a><a class="category-link" href="/categories/后端/golang/protobuf/">protobuf</a><a class="category-link" href="/categories/后端/nodejs/">nodejs</a><a class="category-link" href="/categories/微信小游戏/">微信小游戏</a><a class="category-link" href="/categories/插件/">插件</a><a class="category-link" href="/categories/自动构建工具/">自动构建工具</a>
        </div>
        <div id="sidebar-menu-box-tags">
            <a href="/tags/9宫格/" style="font-size: 10px;">9宫格</a> <a href="/tags/Cocos-Creator/" style="font-size: 20px;">Cocos Creator</a> <a href="/tags/IT/" style="font-size: 10px;">IT</a> <a href="/tags/QQ玩一玩/" style="font-size: 10px;">QQ玩一玩</a> <a href="/tags/TweenLite/" style="font-size: 10px;">TweenLite</a> <a href="/tags/WebGL/" style="font-size: 10px;">WebGL</a> <a href="/tags/android-studio/" style="font-size: 10px;">android studio</a> <a href="/tags/bgfx/" style="font-size: 12.5px;">bgfx</a> <a href="/tags/c/" style="font-size: 12.5px;">c++</a> <a href="/tags/cocos2d-x/" style="font-size: 15px;">cocos2d-x</a> <a href="/tags/cpp/" style="font-size: 12.5px;">cpp</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/git-扩展工具/" style="font-size: 10px;">git 扩展工具</a> <a href="/tags/github-page/" style="font-size: 10px;">github page</a> <a href="/tags/git命令/" style="font-size: 10px;">git命令</a> <a href="/tags/golang/" style="font-size: 15px;">golang</a> <a href="/tags/hello-world/" style="font-size: 10px;">hello world</a> <a href="/tags/hexo/" style="font-size: 12.5px;">hexo</a> <a href="/tags/js/" style="font-size: 12.5px;">js</a> <a href="/tags/lua/" style="font-size: 12.5px;">lua</a> <a href="/tags/nodejs/" style="font-size: 10px;">nodejs</a> <a href="/tags/optionParser/" style="font-size: 10px;">optionParser</a> <a href="/tags/protobuf/" style="font-size: 10px;">protobuf</a> <a href="/tags/python/" style="font-size: 17.5px;">python</a> <a href="/tags/scons/" style="font-size: 12.5px;">scons</a> <a href="/tags/spine/" style="font-size: 10px;">spine</a> <a href="/tags/sublime插件/" style="font-size: 10px;">sublime插件</a> <a href="/tags/websocket/" style="font-size: 10px;">websocket</a> <a href="/tags/xmake/" style="font-size: 12.5px;">xmake</a> <a href="/tags/优化/" style="font-size: 12.5px;">优化</a> <a href="/tags/前端/" style="font-size: 15px;">前端</a> <a href="/tags/博客/" style="font-size: 10px;">博客</a> <a href="/tags/原型链/" style="font-size: 10px;">原型链</a> <a href="/tags/后端/" style="font-size: 10px;">后端</a> <a href="/tags/广告/" style="font-size: 10px;">广告</a> <a href="/tags/微信小游戏/" style="font-size: 20px;">微信小游戏</a> <a href="/tags/缺少dll/" style="font-size: 10px;">缺少dll</a> <a href="/tags/闭包/" style="font-size: 10px;">闭包</a>
        </div>
    </div>
    <a href="javascript:;" class="sidebar-menu-box-close">&times;</a>
</div>
<div class="mobile-header-menu-nav" id="mobile-header-menu-nav">
    <div class="mobile-header-menu-container">
        <span class="title">Menus</span>
        <ul class="mobile-header-menu-navbar">
            
            <li>
                <a  href="/">
                    <i class="fa fa-home"></i><span>Home</span>
                </a>
            </li>
            
            <li>
                <a  href="/archives">
                    <i class="fa fa-archive"></i><span>Archives</span>
                </a>
            </li>
            
            <li>
                <a  href="/about">
                    <i class="fa fa-user"></i><span>About</span>
                </a>
            </li>
            
        </ul>
    </div>
    <div class="mobile-header-tag-container">
        <span class="title">Tags</span>
        <div id="mobile-header-container-tags">
            <a href="/tags/9宫格/" style="font-size: 10px;">9宫格</a> <a href="/tags/Cocos-Creator/" style="font-size: 20px;">Cocos Creator</a> <a href="/tags/IT/" style="font-size: 10px;">IT</a> <a href="/tags/QQ玩一玩/" style="font-size: 10px;">QQ玩一玩</a> <a href="/tags/TweenLite/" style="font-size: 10px;">TweenLite</a> <a href="/tags/WebGL/" style="font-size: 10px;">WebGL</a> <a href="/tags/android-studio/" style="font-size: 10px;">android studio</a> <a href="/tags/bgfx/" style="font-size: 12.5px;">bgfx</a> <a href="/tags/c/" style="font-size: 12.5px;">c++</a> <a href="/tags/cocos2d-x/" style="font-size: 15px;">cocos2d-x</a> <a href="/tags/cpp/" style="font-size: 12.5px;">cpp</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/git-扩展工具/" style="font-size: 10px;">git 扩展工具</a> <a href="/tags/github-page/" style="font-size: 10px;">github page</a> <a href="/tags/git命令/" style="font-size: 10px;">git命令</a> <a href="/tags/golang/" style="font-size: 15px;">golang</a> <a href="/tags/hello-world/" style="font-size: 10px;">hello world</a> <a href="/tags/hexo/" style="font-size: 12.5px;">hexo</a> <a href="/tags/js/" style="font-size: 12.5px;">js</a> <a href="/tags/lua/" style="font-size: 12.5px;">lua</a> <a href="/tags/nodejs/" style="font-size: 10px;">nodejs</a> <a href="/tags/optionParser/" style="font-size: 10px;">optionParser</a> <a href="/tags/protobuf/" style="font-size: 10px;">protobuf</a> <a href="/tags/python/" style="font-size: 17.5px;">python</a> <a href="/tags/scons/" style="font-size: 12.5px;">scons</a> <a href="/tags/spine/" style="font-size: 10px;">spine</a> <a href="/tags/sublime插件/" style="font-size: 10px;">sublime插件</a> <a href="/tags/websocket/" style="font-size: 10px;">websocket</a> <a href="/tags/xmake/" style="font-size: 12.5px;">xmake</a> <a href="/tags/优化/" style="font-size: 12.5px;">优化</a> <a href="/tags/前端/" style="font-size: 15px;">前端</a> <a href="/tags/博客/" style="font-size: 10px;">博客</a> <a href="/tags/原型链/" style="font-size: 10px;">原型链</a> <a href="/tags/后端/" style="font-size: 10px;">后端</a> <a href="/tags/广告/" style="font-size: 10px;">广告</a> <a href="/tags/微信小游戏/" style="font-size: 20px;">微信小游戏</a> <a href="/tags/缺少dll/" style="font-size: 10px;">缺少dll</a> <a href="/tags/闭包/" style="font-size: 10px;">闭包</a>
        </div>
    </div>
</div>
<div class="search-wrap">
    <span class="search-close">&times;</span>
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
            <i class="icon icon-lg icon-chevron-left"></i>
        </a>
        <input class="search-field" placeholder="Search..." id="keywords">
        <a id="search-submit" href="javascript:;">
            <i class="fa fa-search"></i>
        </a>
    <div class="search-container" id="search-container">
        <ul class="search-result" id="search-result">
        </ul>
    </div>
</div>

<div id="search-tpl">
    <li class="search-result-item">
        <a href="{url}" class="search-item-li">
            <span class="search-item-li-title" title="{title}">{title}</span>
        </a>
    </li>
</div>
<script src="/js/search.js"></script>
<script src="/js/main.js"></script>


  <script src="//cdn.bootcss.com/particles.js/2.0.0/particles.min.js"></script>
  <div id="particles"></div>
  <script src="/js/particles.js"></script>







  <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">
  <script src="//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js"></script>
  <script src="/js/animate.js"></script>


  <script src="/js/pop-img.js"></script>
  <script>
     $(".article-entry p img").popImg();
  </script>

  </div>
</body>
</html>